<!--
  @author nowind
  @since 2018/10/19 08:59
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>配件管理</title>
    <th:block th:replace="common/common :: jscss"/>
</head>
<body th:with="
hasEdit=${#authPermit.checkPermit('/part/addEdit.action')},
hasStatus=${#authPermit.checkPermit('/part/ajax/updateStatus.action')},
isAdmin=${#authPermit.checkPermit('isAdmin')},
showHq=${#authPermit.checkPermit('/part/price/showHq.action')},
showSub=${#authPermit.checkPermit('/part/price/showSub.action')},
hasRelation=${#authPermit.checkPermit('/part/relation/list.action')},
hasUnit=${#authPermit.checkPermit('/part/unit/list.action')}
">

<div class="layui-fluid">

    <blockquote class="layui-crumb">
        配件管理>
        <a lay-href="/part/list.action">配件管理</a>
    </blockquote>

    <div class="layui-card">

        <div class="layui-split">&nbsp;</div>

        <div class="layui-form" th:include="part/_query :: query "></div>

        <div class="layui-card-body">
            <table class="layui-hide" id="zmn-part-table" lay-filter="zmn-part-table"></table>
        </div>

    </div>

</div>

<script type="text/javascript" th:inline="javascript">

    let permission = {
        isAdmin: [[${isAdmin}]],
        hasEdit: [[${hasEdit}]],
        hasStatus: [[${hasStatus}]],
        showHq: [[${showHq}]],
        showSub: [[${showSub}]],
        hasRelation: [[${hasRelation}]],
        hasUnit: [[${hasUnit}]],
    };

    layui.config({
        base: "/static/lay/",
        version: 202009091551
    }).extend({
        index: "lib/index",
        plat_partSku: "{/}/static/js/module/part/zmn.plat.partSku.list"
    }).use(['index', 'plat_partSku']);

</script>

<div th:replace="part/partCommonTemplet::statusTemplet"></div>

<script type="text/html" id="zmn-part-table-tool">

    <div class="layui-btn-container">
        {{#  if(permission.hasStatus){ }}
        <div class="layui-btn-group">
            <button class="layui-btn layui-btn-sm" lay-event="start">启用</button>
            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="stop">停用</button>
        </div>
        {{#}}}
        {{#  if(permission.hasEdit){ }}
        <div class="layui-btn-group">
            <button lay-href="/part/addEdit.action" class="layui-btn layui-btn-sm layui-btn-primary" lay-text="新增配件">+新增</button>
        </div>
        {{#}}}
        <div class="layui-btn-group" >
            <button th:if="${isAdmin}" class="layui-btn layui-btn-sm layui-btn-primary" id="rebuildIndex_part">重建配件索引</button>
            <button th:if="${hasRelation}" class="layui-btn layui-btn-sm layui-btn-primary" lay-event="relation">配件拆分管理</button>
            <button  th:if="${hasUnit}" class="layui-btn layui-btn-sm layui-btn-primary" lay-event="unit">单位换算比例</button>
            <button class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="query-export" id="query-export">导出</button>
        </div>

    </div>

</script>


<script type="text/html" id="zmn-part-table-bar">
    {{#  if(permission.hasEdit){ }}
    <div>
        <!--    <a lay-href="/part/addedit/" lay-event="edit" class="layui-btn layui-btn-xs">编辑</a>-->
        <a lay-href="/part/addEdit.action?skuId={{d.skuId}}" lay-text="编辑[{{d.name}}]" class="layui-btn layui-btn-xs">编辑</a>
    </div>
    {{#}}}

</script>

</body>
</html>